package com.pro_one.dao;

import com.pro_one.pojo.CheckGroup;
import com.pro_one.pojo.Setmeal;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface SetmealDao {

    List<Setmeal> findByCondition(String queryString);

    void addSetmeal(Setmeal setmeal);

    void addGroupIdAndSetmealId(@Param("checkgroupId") Integer checkgroupId, @Param("setmealId") Integer id);

    Setmeal findById(Integer id);

    List<CheckGroup> findAllGroupsByMealId(Integer id);

    List<Integer> findAssociations(Integer id);

    void edit(Setmeal setmeal);

    void deleteGroupIdByMealId(Integer id);

    void deleteById(Integer id);

    List<Setmeal> findAll();

    List<Setmeal> findAllGroupAndItem();

    List<Map<String, Object>> getSetmealCount();

    List<Map> findHotSetmeal();



    /*SELECT  s.name name,COUNT(o.id)*s.price value
    FROM t_order o INNER JOIN t_setmeal s ON s.id = o.setmeal_id
    WHERE o.orderDate BETWEEN #{begin} AND #{end}
    GROUP BY o.setmeal_id
    ORDER BY price
    */

    @Select(" select\n" +
            "s.name , COUNT(o.setmeal_id) * s.price  value\n" +
            "from t_setmeal s , t_order o\n" +
            "where orderdate = #{orderDay}\n" +
            "and orderstatus = '已完成'\n" +
            "and o.setmeal_id = s.id\n" +
            "group by s.name\n" +
            "order by s.price asc")
    List<Map<String, Object>> setmealMoneyCount(String order);
    List<String> findAllOptions3();

    List<Setmeal> findByCondition1(Integer id);
    List<Setmeal> getOrderAndSetmeal(String telephone);

}
